stocks60$stocks_hourly_diff = stocks60$stocks_hourly %>% diff() %>% append(NA, 0) # Difference for moving averages
stocks60$stocks_hourly_diff_ln = stocks60$stocks_hourly %>% log() %>% diff() %>% append(NA, 0) # Log then difference for variance stabilization
stocks60$day_count = stocks60$dt_hourly %>% date() %>% as.integer() - stocks60$dt_hourly %>% date() %>% as.integer() %>% min() + 1 # Counting the days
stocks60$morality =
stocks60$care_p_hourly*stocks60$care_sent_hourly +
stocks60$fairness_p_hourly*stocks60$fairness_sent_hourly +
stocks60$loyalty_p_hourly*stocks60$loyalty_sent_hourly +
stocks60$authority_p_hourly*stocks60$authority_sent_hourly +
stocks60$sanctity_p_hourly*stocks60$sanctity_sent_hourly
stocks60$morality_lag = lag(stocks60$morality) # lag morality index
stocks60$care_p_hourly_lag = lag(stocks60$care_p_hourly) # lag moral probabilities
stocks60$fairness_p_hourly_lag = (stocks60$fairness_p_hourly)
stocks60$loyalty_p_hourly_lag = lag(stocks60$loyalty_p_hourly)
stocks60$authority_p_hourly_lag = lag(stocks60$authority_p_hourly)
stocks60$sanctity_p_hourly_lag = lag(stocks60$sanctity_p_hourly)
stocks60$care_sent_hourly_lag = lag(stocks60$care_sent_hourly) # lag moral sentiments
stocks60$fairness_sent_hourly_lag = lag(stocks60$fairness_sent_hourly)
stocks60$loyalty_sent_hourly_lag = lag(stocks60$loyalty_sent_hourly)
stocks60$authority_sent_hourly_lag = lag(stocks60$authority_sent_hourly)
stocks60$sanctity_sent_hourly_lag = lag(stocks60$sanctity_sent_hourly)
stocks60$care_lag = stocks60$care_p_hourly_lag * stocks60$care_sent_hourly_lag # lag probability*sentiments
stocks60$fairness_lag = stocks60$fairness_p_hourly_lag * stocks60$fairness_sent_hourly_lag
stocks60$loyalty_lag = stocks60$loyalty_p_hourly_lag * stocks60$loyalty_sent_hourly_lag
stocks60$authority_lag = stocks60$authority_p_hourly_lag * stocks60$authority_sent_hourly_lag
stocks60$sanctity_lag = stocks60$sanctity_p_hourly_lag * stocks60$sanctity_sent_hourly_lag
stocks60_ordered = stocks60[, c(1, 24, 2:4, 16:21, 5, 22, 23, 25, 6:15, 27:36, 26, 37:41)] # REORDER COLUMNS
stocks60_ordered %>% colnames() # DISPLAY COL NAMES
## [1] "dt_hourly" "day_count" "season_intraday_hourly" "season_workday_hourly"
## [5] "season_month_hourly" "tf1_hourly" "tf2_hourly" "tf3_hourly"
## [9] "tf4_hourly" "tf5_hourly" "tf6_hourly" "stocks_hourly"
## [13] "stocks_hourly_diff" "stocks_hourly_diff_ln" "morality" "care_p_hourly"
## [17] "fairness_p_hourly" "loyalty_p_hourly" "authority_p_hourly" "sanctity_p_hourly"
## [21] "care_sent_hourly" "fairness_sent_hourly" "loyalty_sent_hourly" "authority_sent_hourly"
## [25] "sanctity_sent_hourly" "care_p_hourly_lag" "fairness_p_hourly_lag" "loyalty_p_hourly_lag"
## [29] "authority_p_hourly_lag" "sanctity_p_hourly_lag" "care_sent_hourly_lag" "fairness_sent_hourly_lag"
## [33] "loyalty_sent_hourly_lag" "authority_sent_hourly_lag" "sanctity_sent_hourly_lag" "morality_lag"
## [37] "care_lag" "fairness_lag" "loyalty_lag" "authority_lag"
## [41] "sanctity_lag"
stocks60ts = ts(stocks60_ordered) # MAKE TIME SERIES
plot(stocks60ts[,"stocks_hourly"]) # PLOT INITIAL DATA
acf(stocks60_ordered$stocks_hourly, lag.max = NULL, type = c("correlation"), plot = TRUE, na.action = na.pass) # ACF FOR NON-TRANSFORMED DATA
acf(stocks60_ordered$stocks_hourly, lag.max = NULL, type = c("partial"), plot = TRUE, na.action = na.pass) # PACF FOR NON-TRANSFORMED DATA
acf(stocks60_ordered$stocks_hourly_diff_ln, lag.max = NULL, type = c("correlation"), plot = TRUE, na.action = na.pass) # ACF FOR TRANSFORMED DATA
acf(stocks60_ordered$stocks_hourly_diff_ln, lag.max = NULL, type = c("partial"), plot = TRUE, na.action = na.pass) # PACF FOR TRANSFORMED DATA
plot(stocks60ts[,"stocks_hourly_diff_ln"]) # UNSTABLE VARIANCE IN CONTRACTION AND RECOVERY PERIOD - NEED GARCH MODEL
# Data Exploration
hist(stocks60_ordered[16:25]) # PROB & SENT
hist(stocks60_ordered[26:35]) # PROB & SENT LAG
hist(stocks60_ordered[, c(15,36)]) # MORALITY & MORALITY LAG
hist(stocks60_ordered[37:41]) # FOUNDATIONS LAG
hist(stocks60_ordered[14]) # TRANSFORMED STOCKS
# VIOLIN
plot_violin <- function(input) {
return(input + geom_violin(trim = FALSE) + stat_summary(fun.data = "mean_sdl", fun.args = list(mult = 1), geom = "pointrange", color = "black"))}
# DOUBLE VIOLIN
plot_violin2 <- function(input) {
return(input + geom_violin(aes(color = tf2_hourly), trim = FALSE,position = position_dodge(0.9)) + geom_boxplot(aes(color = tf2_hourly),width = 0.60, position = position_dodge(0.9)) + scale_color_manual(values = c("#00AFBB","#E7B800")))}
# BOXPLOT
plot_boxplot <- function(input) {
return(input + geom_boxplot(notch = TRUE, fill = "lightgray") +stat_summary(fun.y = mean, geom = "point",shape = 18, size = 2.5, color = "#FC4E07"))}
# SCATTERPLOT
plot_scatter <- function(input) {
return(ggplot(stocks60_ordered, aes(input, stocks_hourly_diff_ln, color=tf2_hourly)) + geom_point() + geom_smooth(method=lm) +scale_color_manual(values = c('#999999','#E69F00')) + theme(legend.position=c(0,1), legend.justification=c(0,1)))}
# X DENSITY
plot_xdensity <- function(input) {
return(ggplot(stocks60_ordered, aes(input, fill=tf2_hourly)) +geom_density(alpha=.5) +scale_fill_manual(values = c('#999999','#E69F00')) + theme(legend.position = "none") )}
# Y DENSITY
plot_ydensity <- function() {return(ggplot(stocks60_ordered, aes(stocks_hourly_diff_ln, fill=tf2_hourly)) +geom_density(alpha=.5) +scale_fill_manual(values = c('#999999','#E69F00')) +theme(legend.position = "none") )}
# BLANK PLOT
plot_blank <- function() {
return(ggplot() + geom_blank(aes(1,1)) +theme(plot.background = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),panel.border = element_blank(), panel.background = element_blank(),axis.title.x = element_blank(),axis.title.y = element_blank(),axis.text.x = element_blank(),axis.text.y = element_blank(),axis.ticks = element_blank()))}
e <- ggplot(stocks60, aes(x = tf2_hourly, y = morality_lag))
plot_boxplot(e) # MORALITY BOX PLOT
plot_violin(e) # MORALITY VIOLIN PLOT
stocks60_foundations_long = melt(stocks60_ordered[, c(7,37:41)])
## Using tf2_hourly as id variables
e1 <- ggplot(stocks60_foundations_long, aes(x = variable, y = value))
plot_violin(e1) # FOUNDATIONS VIOLIN PLOT
plot_boxplot(e1) # FOUNDATIONS BOX PLOT
plot_violin2(e1) # FOUNDATIONS BY TF VIOLIN PLOT
scatterPlot <- plot_scatter(stocks60_ordered$morality_lag)
xdensity <- plot_xdensity(stocks60_ordered$morality_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # MORALITY PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$care_lag)
xdensity <- plot_xdensity(stocks60_ordered$care_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # CARE PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$fairness_lag)
xdensity <- plot_xdensity(stocks60_ordered$fairness_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # FAIRNESS PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$loyalty_lag)
xdensity <- plot_xdensity(stocks60_ordered$loyalty_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # LOYALTY PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$authority_lag)
xdensity <- plot_xdensity(stocks60_ordered$authority_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # AUTHORITY PLOT
## `geom_smooth()` using formula 'y ~ x'
scatterPlot <- plot_scatter(stocks60_ordered$sanctity_lag)
xdensity <- plot_xdensity(stocks60_ordered$sanctity_lag)
ydensity <- plot_ydensity()
blankPlot <- plot_blank()
grid.arrange(xdensity, blankPlot, scatterPlot, ydensity, ncol=2, nrow=2, widths=c(4, 1.4), heights=c(1.4, 4)) # SANCTITY PLOT
## `geom_smooth()` using formula 'y ~ x'
omtted <- na.omit(stocks60_ordered)
outlier_rm_IQR <- function(data, df_str, col_str, threshold){
Q <- quantile(data, probs=c(.25, .75), na.rm = FALSE) # 25/75 QUANTILES AFTER REMOVING ROW 1 (NA row)
iqr <- IQR(data) # IQR AFTER REMOVING ROW 1 (NA row)
upper <- Q[2]+threshold*iqr # Upper Range for outliers
lower <- Q[1]-threshold*iqr # Lower Range for outliers
df <- get(df_str)
column <- get(df_str)[col_str]
a <- subset.data.frame(df, column > lower)
b <- subset.data.frame(df, column < upper)
return(intersect(a,b))
}
a <- outlier_rm_IQR(omtted$morality_lag[-1], "stocks60_ordered", "morality_lag", 2.5)
b <- outlier_rm_IQR(omtted$stocks_hourly_diff_ln[-1], "stocks60_ordered", "stocks_hourly_diff_ln", 2.5)
stocks60_outrm <- intersect(a,b)
stocks60_outrm_moralityonly <- outlier_rm_IQR(omtted$morality_lag[-1], "stocks60_ordered", "morality_lag", 2.5)
stocks60.model.lm <- lm(stocks_hourly_diff_ln ~ tf2_hourly * morality_lag,data = omtted)
stocks60.model.lm.foundations <- lm(stocks_hourly_diff_ln ~ tf2_hourly * (care_lag +fairness_lag +loyalty_lag +authority_lag +sanctity_lag), data = omtted)
stocks60.model.lme.null <-lmer(stocks_hourly_diff_ln ~ 1 + (1|day_count), data = omtted, REML=TRUE)
stocks60.model.lme <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*morality_lag + (1 + season_intraday_hourly | day_count)), data = omtted, REML = TRUE)
## boundary (singular) fit: see ?isSingular
stocks60.model.lme.foundations <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*(care_lag + fairness_lag + loyalty_lag + authority_lag + sanctity_lag) + ( 1 + season_intraday_hourly | day_count)), data = omtted, REML = TRUE)
## boundary (singular) fit: see ?isSingular
stocks60.model.lm.outrm <- lm(stocks_hourly_diff_ln ~ tf2_hourly * morality_lag,data = stocks60_outrm_moralityonly)
stocks60.model.lm.foundations.outrm <- lm(stocks_hourly_diff_ln ~ tf2_hourly * (care_lag +fairness_lag +loyalty_lag +authority_lag +sanctity_lag), data = stocks60_outrm_moralityonly)
stocks60.model.lme.null.outrm <-lmer(stocks_hourly_diff_ln ~ 1 + (1|day_count), data = stocks60_outrm_moralityonly, REML=TRUE)
stocks60.model.lme.outrm <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*morality_lag + (1 + season_intraday_hourly | day_count)), data = stocks60_outrm_moralityonly, REML = TRUE)
## boundary (singular) fit: see ?isSingular
stocks60.model.lme.foundations.outrm <- lmer(stocks_hourly_diff_ln ~ (1 + season_intraday_hourly + tf2_hourly*(care_lag + fairness_lag + loyalty_lag + authority_lag + sanctity_lag) + ( 1 + season_intraday_hourly | day_count)), data = stocks60_outrm_moralityonly, REML = TRUE)
## boundary (singular) fit: see ?isSingular
Anova(stocks60.model.lm, type="III", test="F")
Anova(stocks60.model.lm.foundations, type="III", test="F")
Anova(stocks60.model.lme.null, type="III", test="F")
Anova(stocks60.model.lme, type="III", test="F")
Anova(stocks60.model.lme.foundations, type="III", test="F")
anova(stocks60.model.lm, stocks60.model.lm.foundations)
anova(stocks60.model.lme.null, stocks60.model.lme, stocks60.model.lme.foundations)
## refitting model(s) with ML (instead of REML)
Anova(stocks60.model.lm.outrm, type="III", test="F")
Anova(stocks60.model.lm.foundations.outrm, type="III", test="F")
Anova(stocks60.model.lme.null.outrm, type="III", test="F")
Anova(stocks60.model.lme.outrm, type="III", test="F")
Anova(stocks60.model.lme.foundations.outrm, type="III", test="F")
anova(stocks60.model.lm.outrm, stocks60.model.lm.foundations.outrm)
anova(stocks60.model.lme.null.outrm, stocks60.model.lme.outrm, stocks60.model.lme.foundations.outrm)
## refitting model(s) with ML (instead of REML)
summ(stocks60.model.lm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1037
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(3,1033) = 12.588, p = 0.000
## R² = 0.035
## Adj. R² = 0.032
##
## Standard errors: OLS
## -------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ----------------------------- -------- -------- -------- -------- -------
## (Intercept) 0.038 -0.029 0.105 1.119 0.263
## tf2_hourly -0.348 -0.509 -0.187 -4.234 0.000
## morality_lag -0.004 -0.068 0.060 -0.112 0.910
## tf2_hourly:morality_lag 0.540 0.341 0.739 5.317 0.000
## -------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1037
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2806.713, BIC = 2851.209
## Pseudo-R² (fixed effects) = 0.021
## Pseudo-R² (total) = 0.303
##
## FIXED EFFECTS:
## -----------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ----------------------------- -------- -------- -------- -------- --------- -------
## (Intercept) 0.029 -0.047 0.106 0.755 183.568 0.451
## season_intraday_hourly -0.023 -0.103 0.057 -0.555 173.552 0.580
## tf2_hourly -0.266 -0.425 -0.108 -3.272 192.754 0.001
## morality_lag -0.012 -0.074 0.050 -0.376 486.680 0.707
## tf2_hourly:morality_lag 0.408 0.218 0.597 4.187 846.259 0.000
## -----------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.330
## day_count season_intraday_hourly 0.413
## Residual 0.831
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 173 0.136
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lm.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1020
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(3,1016) = 8.063, p = 0.000
## R² = 0.023
## Adj. R² = 0.020
##
## Standard errors: OLS
## -------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ----------------------------- -------- -------- -------- -------- -------
## (Intercept) 0.035 -0.032 0.103 1.022 0.307
## tf2_hourly -0.289 -0.450 -0.127 -3.500 0.000
## morality_lag 0.013 -0.052 0.078 0.402 0.688
## tf2_hourly:morality_lag 0.395 0.199 0.591 3.961 0.000
## -------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1020
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2767.514, BIC = 2811.862
## Pseudo-R² (fixed effects) = 0.011
## Pseudo-R² (total) = 0.303
##
## FIXED EFFECTS:
## -----------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ----------------------------- -------- -------- -------- -------- --------- -------
## (Intercept) 0.029 -0.049 0.107 0.735 182.574 0.463
## season_intraday_hourly -0.022 -0.104 0.059 -0.537 172.677 0.592
## tf2_hourly -0.213 -0.371 -0.055 -2.633 181.678 0.009
## morality_lag -0.006 -0.069 0.056 -0.193 655.316 0.847
## tf2_hourly:morality_lag 0.251 0.070 0.431 2.697 770.252 0.007
## -----------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.337
## day_count season_intraday_hourly 0.420
## Residual 0.832
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 172 0.141
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lm.foundations, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1037
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(11,1025) = 6.573, p = 0.000
## R² = 0.066
## Adj. R² = 0.056
##
## Standard errors: OLS
## --------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ------------------------------ -------- -------- -------- -------- -------
## (Intercept) 0.038 -0.029 0.104 1.115 0.265
## tf2_hourly -0.177 -0.347 -0.006 -2.028 0.043
## care_lag 0.098 -0.090 0.287 1.024 0.306
## fairness_lag -0.180 -0.397 0.038 -1.618 0.106
## loyalty_lag 0.083 -0.129 0.295 0.772 0.440
## authority_lag 0.027 -0.180 0.234 0.255 0.799
## sanctity_lag -0.030 -0.180 0.120 -0.390 0.697
## tf2_hourly:care_lag -0.397 -0.961 0.168 -1.378 0.168
## tf2_hourly:fairness_lag -0.842 -1.450 -0.234 -2.716 0.007
## tf2_hourly:loyalty_lag 0.237 -0.304 0.778 0.860 0.390
## tf2_hourly:authority_lag 0.382 -0.142 0.905 1.431 0.153
## tf2_hourly:sanctity_lag 1.075 0.596 1.554 4.407 0.000
## --------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme.foundations, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1037
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2817.247, BIC = 2901.296
## Pseudo-R² (fixed effects) = 0.045
## Pseudo-R² (total) = 0.308
##
## FIXED EFFECTS:
## ------------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ------------------------------ -------- -------- -------- -------- --------- -------
## (Intercept) 0.036 -0.040 0.112 0.921 180.648 0.358
## season_intraday_hourly -0.045 -0.123 0.034 -1.118 178.325 0.265
## tf2_hourly -0.175 -0.341 -0.010 -2.068 215.090 0.040
## care_lag 0.116 -0.061 0.292 1.272 696.219 0.204
## fairness_lag -0.186 -0.393 0.022 -1.740 973.521 0.082
## loyalty_lag 0.057 -0.143 0.256 0.554 852.786 0.580
## authority_lag 0.023 -0.171 0.217 0.227 904.013 0.820
## sanctity_lag -0.021 -0.167 0.126 -0.274 606.966 0.784
## tf2_hourly:care_lag -0.151 -0.674 0.371 -0.563 892.094 0.573
## tf2_hourly:fairness_lag -0.774 -1.366 -0.182 -2.547 932.391 0.011
## tf2_hourly:loyalty_lag 0.363 -0.151 0.877 1.376 893.435 0.169
## tf2_hourly:authority_lag 0.056 -0.429 0.542 0.226 845.596 0.821
## tf2_hourly:sanctity_lag 0.809 0.333 1.284 3.315 996.881 0.001
## ------------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.328
## day_count season_intraday_hourly 0.392
## Residual 0.829
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 173 0.136
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lm.foundations.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## MODEL INFO:
## Observations: 1020
## Dependent Variable: stocks_hourly_diff_ln
## Type: OLS linear regression
##
## MODEL FIT:
## F(11,1008) = 5.605, p = 0.000
## R² = 0.058
## Adj. R² = 0.047
##
## Standard errors: OLS
## --------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. p
## ------------------------------ -------- -------- -------- -------- -------
## (Intercept) 0.035 -0.032 0.102 1.012 0.312
## tf2_hourly -0.111 -0.283 0.060 -1.274 0.203
## care_lag 0.089 -0.081 0.258 1.028 0.304
## fairness_lag -0.167 -0.363 0.029 -1.670 0.095
## loyalty_lag 0.088 -0.103 0.279 0.905 0.366
## authority_lag 0.037 -0.148 0.221 0.390 0.697
## sanctity_lag -0.030 -0.168 0.108 -0.425 0.671
## tf2_hourly:care_lag -0.403 -0.908 0.101 -1.570 0.117
## tf2_hourly:fairness_lag -0.778 -1.315 -0.240 -2.840 0.005
## tf2_hourly:loyalty_lag 0.242 -0.240 0.724 0.985 0.325
## tf2_hourly:authority_lag 0.188 -0.287 0.663 0.776 0.438
## tf2_hourly:sanctity_lag 1.049 0.610 1.488 4.687 0.000
## --------------------------------------------------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
summ(stocks60.model.lme.foundations.outrm, scale=TRUE, transform.response=TRUE, confint=TRUE, digits=3)
## boundary (singular) fit: see ?isSingular
## MODEL INFO:
## Observations: 1020
## Dependent Variable: stocks_hourly_diff_ln
## Type: Mixed effects linear regression
##
## MODEL FIT:
## AIC = 2772.081, BIC = 2855.849
## Pseudo-R² (fixed effects) = 0.043
## Pseudo-R² (total) = 0.320
##
## FIXED EFFECTS:
## ------------------------------------------------------------------------------------
## Est. 2.5% 97.5% t val. d.f. p
## ------------------------------ -------- -------- -------- -------- --------- -------
## (Intercept) 0.037 -0.041 0.116 0.934 180.043 0.352
## season_intraday_hourly -0.048 -0.128 0.031 -1.189 177.698 0.236
## tf2_hourly -0.114 -0.278 0.050 -1.360 200.805 0.175
## care_lag 0.102 -0.056 0.260 1.261 680.515 0.208
## fairness_lag -0.171 -0.357 0.016 -1.785 953.249 0.075
## loyalty_lag 0.063 -0.115 0.241 0.687 832.719 0.492
## authority_lag 0.019 -0.153 0.191 0.213 893.350 0.831
## sanctity_lag -0.020 -0.154 0.114 -0.294 587.916 0.769
## tf2_hourly:care_lag -0.173 -0.635 0.289 -0.731 870.379 0.465
## tf2_hourly:fairness_lag -0.814 -1.336 -0.291 -3.029 911.902 0.003
## tf2_hourly:loyalty_lag 0.388 -0.067 0.843 1.660 877.826 0.097
## tf2_hourly:authority_lag -0.166 -0.602 0.271 -0.740 837.262 0.459
## tf2_hourly:sanctity_lag 0.873 0.439 1.308 3.914 980.712 0.000
## ------------------------------------------------------------------------------------
##
## p values calculated using Kenward-Roger standard errors and d.f.
##
## RANDOM EFFECTS:
## ------------------------------------------------
## Group Parameter Std. Dev.
## ----------- ------------------------ -----------
## day_count (Intercept) 0.342
## day_count season_intraday_hourly 0.401
## Residual 0.824
## ------------------------------------------------
##
## Grouping variables:
## ------------------------------
## Group # groups ICC
## ----------- ---------- -------
## day_count 172 0.147
## ------------------------------
##
## Continuous variables are mean-centered and scaled by 1 s.d.
plot1 <- interact_plot(stocks60.model.lm, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.outrm, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lme, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lme.outrm, pred = morality_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = care_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = care_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = fairness_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = fairness_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = loyalty_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = loyalty_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = authority_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = authority_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)
plot1 <- interact_plot(stocks60.model.lm.foundations, pred = sanctity_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
plot2 <- interact_plot(stocks60.model.lm.foundations.outrm, pred = sanctity_lag, modx = tf2_hourly, plot.points = TRUE, linearity.check = FALSE) + ylim(-0.04,0.04)
gridExtra::grid.arrange(plot1, plot2, ncol=2)